<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        td {
            border: 1px solid;
        }

        table {
            /* 边框塌陷 */
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <table>

    </table>


    <script>
        let table = document.getElementsByTagName('table')[0];
        debugger;
        for (let i = 1; i <= 9; i++) {//控制行
            //创建行
            let tr = document.createElement('tr');
            for (let j = 1; j <= i; j++) {
                //创建td
                let td = document.createElement('td');
                //创建文本节点
                let text = document.createTextNode(`${j}*${i}=${j * i}`);
                td.appendChild(text)
                tr.appendChild(td)
            }
            table.appendChild(tr)
        }
    </script>

</body>

</html>